﻿using Client.MirObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.Command
{
    static class AliveChecker
    {
        public static long checkTime=0;
        public static uint objId = 0;
        public static uint hpPrecent = 0;

        public static bool Check(this MonsterObject ob)
        {
            if (checkTime < CMain.Now.Ticks)
            {
                checkTime = CMain.Now.Ticks + 10000 * 10000;
                return true;
            }
            checkTime = CMain.Now.Ticks + 10000 * 10000;
            if (ob== null || ob.Dead)
                return false;
            if(ob.ObjectID!=objId)
            {
                objId = ob.ObjectID;
                hpPrecent = ob.PercentHealth;
                return true;
            }
            if(ob.PercentHealth==0&&ob.PercentHealth==hpPrecent)
            {
                return false;
            }
            hpPrecent = ob.PercentHealth;
            return false;

        }


    }
}
